package cn.wyf.demo.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestHeader;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.wyf.demo.service.XmlTestService;

@Controller
@RequestMapping(value = "/xmltest", produces = "application/xml;charset=utf-8")
public class XmlTestController {
    @Autowired
    private XmlTestService xmlTestService;

    @RequestMapping(value = "/test", method = RequestMethod.GET)
    @ResponseBody
    public Object xmlData(@RequestHeader("Accept") String accept) {
        System.out.println("======xmlData========");
        System.out.println("accetp:" + accept);
        String xmlData = xmlTestService.getXmlData();
        System.out.println(xmlData);
        return xmlData;
    }

}
